let ImportService = require('./ImportService')

class TestCaseService extends ImportService{
  initParam () {
    this.tableConfigs = [
      { tableName: 'users' }
    ]
  }

  formateData (dataList, { setId }) {
    return new Promise((resolve, reject) => {
      let rowDatas = []
      let data = {}
      // 1.数据转换
      for (let i = 0, len = dataList.length; i < len; i++) {
        data = dataList[i]
        rowDatas.push({
          "level": data[0],
          "business": data[1],
          "type": data[2],
          "use": data[3],
          "ownerUser": data[4],
          "useDate": data[5],
          "system": data[6],
          "resouceState": data[7],
          "cpu": data[8],
          "ram": data[9],
          "hdd": data[10],
          "name": data[11],
          "address": data[12],
          "ip": data[13],
          "account": data[14],
          "pwd": data[15],
          "soft": data[16],
          "updateDate": data[18],
          "updateUser": data[19],
          "orgId": this.user.orgId,
          "createDate": new Date(),
          "createUser": this.user.userName
        })        
      }
      resolve(rowDatas)
    })
  }
}

module.exports = new TestCaseService()